import request, { download } from '@/utils/request'

// 获取供应商下拉列表
export function getSupplierList() {
  return request({
    url: '/operation/web/operationPharmaceuticalPurchase/supplierList',
    method: 'get'
  })
}

// 获取药剂类型下拉列表
export function getMedicineSupplierTypeList() {
  return request({
    url: '/operation/web/operationPharmaceuticalPurchase/medicineSupplierTypeList',
    method: 'get'
  })
}

// 查询药剂采购列表
export function getPharmaceuticalPurchaseList(params) {
  return request({
    url: '/operation/web/operationPharmaceuticalPurchase/list',
    method: 'get',
    params
  })
}

// 获取药剂采购详细信息
export function getPharmaceuticalPurchaseDetail(id) {
  return request({
    url: `/operation/web/operationPharmaceuticalPurchase/${id}`,
    method: 'get'
  })
}

// 新增药剂采购
export function addPharmaceuticalPurchase(data) {
  return request({
    url: '/operation/web/operationPharmaceuticalPurchase',
    method: 'post',
    data
  })
}

// 修改药剂采购
export function updatePharmaceuticalPurchase(data) {
  return request({
    url: '/operation/web/operationPharmaceuticalPurchase',
    method: 'put',
    data
  })
}

// 审批药剂采购
export function approvePharmaceuticalPurchase(data) {
  return request({
    url: '/operation/web/operationPharmaceuticalPurchase/approval',
    method: 'put',
    data
  })
}

// 取消药剂采购
export function cancelPharmaceuticalPurchase(id) {
  return request({
    url: `/operation/web/operationPharmaceuticalPurchase/cancel/${id}`,
    method: 'get'
  })
}

// 删除药剂采购
export function deletePharmaceuticalPurchase(ids) {
  return request({
    url: `/operation/web/operationPharmaceuticalPurchase/${ids}`,
    method: 'delete'
  })
}

// 导出药剂采购列表
export function exportPharmaceuticalPurchase(params) {
  return download(
    '/operation/web/operationPharmaceuticalPurchase/export',
    params,
    `药剂采购_${Date.now()}.xlsx`
  )
}